package com.njwb.day15.zqzb.method;

import com.njwb.day15.zqzb.method.review.Person;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;

public class MethodDemo01 {
    public static void main(String[] args) {
        Class cls = Person.class;


        //获取类中所有的方法

        Method[] methods = cls.getDeclaredMethods();

        for(Method method:methods) {
            System.out.println("方法名："+method.getName());
            System.out.println("方法的返回值类型:"+method.getReturnType());
            System.out.println("方法的访问修饰符："+ Modifier.toString(method.getModifiers()));
            System.out.println("方法参数的个数："+method.getParameterCount());


            Class[] exceptionTypes = method.getExceptionTypes();

            System.out.println("抛出的异常类型："+ Arrays.toString(exceptionTypes));

            System.out.println("*******************");


        }


    }
}
